home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 406_01 / disked25 / source / error.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-13  |  1.5 KB  |  68 lines

  1. /***
  2. *error.c - errno extension
  3. *
  4. *Copyright (c) 1991-1994, Gregg Jennings.  All wrongs reserved.
  5. *   P O Box 200, Falmouth, MA 02541-0200
  6. *
  7. *Purpose:
  8. *   MS(tm)-DOS Disk EDitor error messages.
  9. *
  10. *Notice:
  11. *   This progam may be freely used and distributed.  Any distrubution
  12. *   with modifications must retain the above copyright statement and
  13. *   modifications noted.
  14. *   No pulp-publication, in whole or in part, permitted without
  15. *   permission (magazines or books).
  16. *******************************************************************************/
  17.  
  18. #include <stdio.h>
  19. #include <string.h>
  20.  
  21. #include "error.h"
  22. #include "mylib.h"
  23.  
  24. struct error_t error;
  25.  
  26. const char *err_msg[] = {
  27.    "Requires DOS 3+",
  28.    "Not Enough Memory",
  29.    "FAT Phase Error",
  30.    "Bad Cluster No.",
  31.    "Bad Start Cluster No.",
  32.    "More files than FAT",
  33.    "Alloc size of zero",
  34.    "Free NULL pointer",
  35.    "Corrupt heap",
  36. };
  37.  
  38. void printerror(int ext)
  39. {
  40.    if (error.num == -1)       /* no error */
  41.       return;
  42.  
  43.    if (ext && error.mod)      /* if extened error info and module named */
  44.    {
  45.       print(error.mod);
  46.       /* if function name and not same as module */
  47.       if (error.func && strcmp(error.mod,error.func))
  48.       {
  49.          send(':');
  50.          print(error.func);
  51.       }
  52.       send(' ');
  53.       error.mod = NULL;
  54.    }
  55.    if (error.msg)
  56.    {
  57.       print(error.msg);
  58.       send(' ');
  59.       error.msg = NULL;
  60.    }
  61.    if (error.arg)
  62.    {
  63.       print(error.arg);
  64.       error.arg = NULL;
  65.    }
  66.    error.num = -1;
  67. }
  68.